package com.atguigu.tingshu.account.rpc;

import com.atguigu.tingshu.account.service.RechargeInfoService;
import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.model.account.RechargeInfo;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author codingyz
 * @Description
 * @date 2025/4/1 20:01
 * @Version 1.0
 */
@RestController
@RequestMapping("/api/account/rechargeInfo")
public class RechargeInfoController {

    @Autowired
    private RechargeInfoService rechargeInfoService;

    @GetMapping("getRechargeInfo/{orderNo}")
    @Operation(summary = "根据订单号获取充值信息")
    Result<RechargeInfo> getRechargeInfo(@PathVariable("orderNo") String orderNo){
        // 调用服务层方法
        RechargeInfo rechargeInfo = rechargeInfoService.getRechargeInfoByOrderNo(orderNo);
        // 返回对象
        return Result.ok(rechargeInfo);
    }
}
